package com.iplant.basic.service.po.cfg;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;


/**
 * 工厂/车间日历 未设置默认非假期自动生成记录并保存
 */
@DBBasePO(TableName = "cfg_calendar_shift", Code = false, Name = false,
        CheckName = {"CurrentDay,WorkshopID,FactoryID"})
public class CFGCalendar extends BasePO implements Serializable {

    private static final long serialVersionUID = 1L;


    @DBCondition(CompareType = DBCondition.DBCompareType.gtLt, ParamName = "StartDate", ParamName2 = "EndDate")
    @DBField
    public Calendar CurrentDay = Calendar.getInstance(); // 日期

    @DBCondition
    @DBField
    public int Year = 0; // 年

    @DBCondition
    @DBField
    public int Month = 0; // 月

    /**
     * 是否休息日  只继承是否休息日  班次信息根据子实体设置生成
     */
    @DBCondition
    @DBField
    public int IsHoliday = 0;

    /**
     *  班次列表 只继承是否休息日  班次信息根据子实体设置生成
     */
    @DBField
    public List<Integer> ShiftList = new ArrayList<>();

    @DBCondition
    @DBField
    public int StationID = 0;
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "fmc_station", tableAsName = "s1", MainTableField = "StationID")
    public String StationName = "";

    @DBJoin(name = "Code", tableName = "fmc_station", tableAsName = "s1", MainTableField = "StationID")
    public String StationCode = "";


    @DBCondition
    @DBField
    public int WorkAreaID = 0;
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "fmc_workarea", tableAsName = "w2", MainTableField = "WorkAreaID")
    public String WorkAreaName = "";

    @DBJoin(name = "Code", tableName = "fmc_workarea", tableAsName = "w2", MainTableField = "WorkAreaID")
    public String WorkAreaCode = "";


    /**
     * 车间  可以不给，也可以不同车间单独设置  应用到车间给对应车间ID 应用到整厂给0
     */
    @DBCondition
    @DBField
    public int WorkshopID = 0;
    @DBJoin(name = "Name", tableName = "fmc_workshop", tableAsName = "w1", JoinIndex = 2, MainTableField = "WorkshopID")
    public String WorkshopName = "";
    @DBJoin(name = "Code", tableName = "fmc_workshop", tableAsName = "w1", JoinIndex = 2, MainTableField = "WorkshopID")
    public String WorkshopCode = "";

    /**
     * 工厂必给 不同工厂日历不同
     */
    @DBCondition
    @DBField
    public int FactoryID = 0;

    @DBJoin(name = "Code", tableName = "fmc_factory", tableAsName = "f1", JoinIndex = 3, MainTableField = "FactoryID")
    public String FactoryCode = "";

    @DBJoin(name = "Name", tableName = "fmc_factory", tableAsName = "f1", JoinIndex = 3, MainTableField = "FactoryID")
    public String FactoryName = "";


    @JsonProperty("CurrentDay")
    public Calendar getCurrentDay() {
        return CurrentDay;
    }

    public void setCurrentDay(Calendar currentDay) {
        CurrentDay = currentDay;
    }

    @JsonProperty("Year")
    public int getYear() {
        return Year;
    }

    public void setYear(int year) {
        Year = year;
    }

    @JsonProperty("Month")
    public int getMonth() {
        return Month;
    }

    public void setMonth(int month) {
        Month = month;
    }

    @JsonProperty("IsHoliday")
    public int getIsHoliday() {
        return IsHoliday;
    }

    public void setIsHoliday(int isHoliday) {
        IsHoliday = isHoliday;
    }

    @JsonProperty("ShiftList")
    public List<Integer> getShiftList() {
        return ShiftList;
    }

    public void setShiftList(List<Integer> shiftList) {
        ShiftList = shiftList;
    }

    @JsonProperty("WorkshopID")
    public int getWorkshopID() {
        return WorkshopID;
    }

    public void setWorkshopID(int workshopID) {
        WorkshopID = workshopID;
    }

    @JsonProperty("WorkshopName")
    public String getWorkshopName() {
        return WorkshopName;
    }

    public void setWorkshopName(String workshopName) {
        WorkshopName = workshopName;
    }

    @JsonProperty("WorkshopCode")
    public String getWorkshopCode() {
        return WorkshopCode;
    }

    public void setWorkshopCode(String workshopCode) {
        WorkshopCode = workshopCode;
    }

    @JsonProperty("FactoryID")
    public int getFactoryID() {
        return FactoryID;
    }

    public void setFactoryID(int factoryID) {
        FactoryID = factoryID;
    }

    @JsonProperty("FactoryCode")
    public String getFactoryCode() {
        return FactoryCode;
    }

    public void setFactoryCode(String factoryCode) {
        FactoryCode = factoryCode;
    }

    @JsonProperty("FactoryName")
    public String getFactoryName() {
        return FactoryName;
    }

    public void setFactoryName(String factoryName) {
        FactoryName = factoryName;
    }
}
